<?php

require_once 'init.php';

$catId = cf\param::get('id');

$newsCat = cf\query2array('SELECT * FROM cf_news_categories WHERE id=:id OR code=:id',array('id'=>$catId));
$smarty->assign('newsCat',$newsCat);

$smarty->assign(
	'news',
	cf\query2arrays("
		SELECT IFNULL(code,cf_news.id) AS id, dt, name, short_txt 
		FROM cf_news
		INNER JOIN cf_news_in_category ON news_id=cf_news.id
		WHERE category_id=:cat
		ORDER BY dt DESC",
		array('cat'=>$newsCat['id'])
	)
);


show(
	'news_list', 
	$newsCat['name'], 
	array(array('name'=>$newsCat['name']))
);

?>